<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="org.hibernate.SessionFactory"%>
<%@ page import="org.hibernate.Session"%>
<%@ page import="java.util.List"%>
<%@ page import="hibernate.model.*"%>
<%@ page import="hibernate.util.HibernateUtil"%>
<%@ page import="hibernate.method.*"%>
<%@ page import="hibernate.method.LocalMethods"%>

<div class="page-header">
	<h2 class="page-title">Tworzenie nowego wydarzenia</h2>
</div>

<br />

<div id="content">

<%
						SessionFactory sessionFactory = HibernateUtil
								.getSessionAnnotationFactory();
						Session s = sessionFactory.openSession();
						s.beginTransaction();
						LocalMethods l_m = new LocalMethods();
						 Integer user_id = (Integer) session.getAttribute("user_id");
							response.setContentType("text/html");
							if (user_id != null) {
						List<Local> llist = l_m.listAllLocals(sessionFactory, s);
						s.getTransaction().commit();
					%> 
<table>
<tr>
<td>
Wybierz lokal: </td>
<td>
 <select name="cat2" id="cat2" class="postform">
                    <option value="0">-- Wybierz lokal --</option>
              
<%                if (llist.size() > 0) {
	for (Local l1 : llist) {
%>
                    <option class="level-0" value="<%=l1.getLocal_id()%>"><%=l1.getStreet() + " " + l1.getLocal_number() + " , "+ l1.getCity() %></option>
                    <%}
	}

	}%>
                      </select>
</td>
</tr>


</table>

</div>